package com.lsmw.common_service.handler;

import com.lsmw.common_service.interceptor.ApiInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
 *ClassName:WebMvcConfig
 *UserName:二号男嘉宾
 *CreateTime:2021/4/19 15:19
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
    public ApiInterceptor getApiInterceptor(){
        return new ApiInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getApiInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/admin/ls-admin/login")
                .excludePathPatterns("/admin/ls-admin/info")
                .excludePathPatterns("/oss/");
    }
}
